package nc.ui.gl.offset.action;

import java.awt.event.ActionEvent;

import nc.bs.framework.common.NCLocator;
import nc.itf.gl.IOffsetMaintain;
import nc.ui.gl.offset.ace.view.ListFrame;
import nc.ui.gl.offset.ace.view.OffsetBillForm;
import nc.ui.pub.beans.UIDialog;
import nc.ui.pubapp.uif2app.query2.action.DefaultQueryAction;
import nc.ui.pubapp.uif2app.view.ShowUpableBillListView;
import nc.ui.querytemplate.querytree.IQueryScheme;
import nc.vo.gl.offset.OffsetVO;

public class QueryAction extends DefaultQueryAction {

	private OffsetBillForm editor;

	private ShowUpableBillListView editor1;
	
	private ShowUpableBillListView editor2;
	
	private ListFrame listFrame;

	public OffsetBillForm getEditor() {
		return editor;
	}

	public void setEditor(OffsetBillForm editor) {
		this.editor = editor;
	}

	public ShowUpableBillListView getEditor1() {
		return editor1;
	}

	public void setEditor1(ShowUpableBillListView editor1) {
		this.editor1 = editor1;
	}


	public ShowUpableBillListView getEditor2() {
		return editor2;
	}

	public void setEditor2(ShowUpableBillListView editor2) {
		this.editor2 = editor2;
	}

	public QueryAction(){
		super();
	}

	public ListFrame getListFrame() {
		if(this.listFrame == null){
			this.listFrame = new ListFrame(this.editor);
		}
		return listFrame;
	}

	@Override
	public void doAction(ActionEvent e) throws Exception {
		
		if (this.getQryDLGDelegator().showModal() == UIDialog.ID_OK) {
			IQueryScheme queryScheme = this.getQryDLGDelegator().getQueryScheme();
			
			OffsetVO[] headvos = NCLocator.getInstance().lookup(IOffsetMaintain.class).queryHead(queryScheme);
			
			editor.show(OffsetBillForm.LIST, headvos);
		}
	}

}
